/*
 * @Author: szx
 * @Date: 2021-10-26 11:19:33
 * @LastEditTime: 2021-10-26 11:30:31
 * @Description:
 * @FilePath: \leetcode\704\704.cpp
 */
#include <iostream>
#include <vector>
using namespace std;

class Solution {
   public:
    int search(vector<int>& nums, int target) {
        int l = 0;
        int r = nums.size();
        while (r > l) {
            int mid = (r - l) / 2 + l;
            if (nums[mid] < target) {
                l = mid + 1;
            } else if (nums[mid] > target) {
                r = mid;
            } else {
                return mid;
            }
        }
        return -1;
    }
};
int main() {}